home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Prg / WAVPLUS.ZIP / CDPLAY.WD_ / CDPLAY.WD
Text File  |  1997-09-14  |  11KB  |  386 lines

  1. VERSION 2.00
  2. Begin Form CDplayer 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "CD Player"
  6.    ClientHeight    =   5880
  7.    ClientLeft      =   2520
  8.    ClientTop       =   1485
  9.    ClientWidth     =   5820
  10.    ControlBox      =   0   'False
  11.    Height          =   6285
  12.    Icon            =   CDPLAY.FRX:0000
  13.    Left            =   2460
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   5880
  17.    ScaleWidth      =   5820
  18.    Top             =   1140
  19.    Width           =   5940
  20.    Begin Timer Timer1 
  21.       Interval        =   500
  22.       Left            =   5520
  23.       Top             =   5580
  24.    End
  25.    Begin CommandButton CmdAll 
  26.       BackColor       =   &H00C0C0C0&
  27.       Caption         =   "Play &All"
  28.       Height          =   495
  29.       Left            =   300
  30.       TabIndex        =   2
  31.       Top             =   4740
  32.       Width           =   2595
  33.    End
  34.    Begin CheckBox CheckLoop 
  35.       Alignment       =   1  'Right Justify
  36.       BackColor       =   &H00C0C0C0&
  37.       Caption         =   "&Continuous Play"
  38.       Height          =   315
  39.       Left            =   3000
  40.       TabIndex        =   6
  41.       Top             =   2520
  42.       Width           =   2595
  43.    End
  44.    Begin CommandButton CmdOkay 
  45.       BackColor       =   &H00C0C0C0&
  46.       Caption         =   "O &K A Y"
  47.       Height          =   495
  48.       Left            =   300
  49.       TabIndex        =   5
  50.       Top             =   5280
  51.       Width           =   5295
  52.    End
  53.    Begin CommandButton CmdNew 
  54.       BackColor       =   &H00C0C0C0&
  55.       Caption         =   "Reset or Read &New CD"
  56.       Height          =   495
  57.       Left            =   3000
  58.       TabIndex        =   4
  59.       Top             =   4740
  60.       Width           =   2595
  61.    End
  62.    Begin CommandButton CmdStop 
  63.       BackColor       =   &H00C0C0C0&
  64.       Caption         =   "&Stop\Pause"
  65.       Height          =   495
  66.       Left            =   3000
  67.       TabIndex        =   3
  68.       Top             =   4200
  69.       Width           =   2595
  70.    End
  71.    Begin CommandButton CmdPlay 
  72.       BackColor       =   &H00C0C0C0&
  73.       Caption         =   "&Play Selection(s)"
  74.       Height          =   495
  75.       Left            =   300
  76.       TabIndex        =   1
  77.       Top             =   4200
  78.       Width           =   2595
  79.    End
  80.    Begin ListBox List1 
  81.       Height          =   3345
  82.       Left            =   240
  83.       MultiSelect     =   1  'Simple
  84.       TabIndex        =   0
  85.       Top             =   660
  86.       Width           =   2595
  87.    End
  88.    Begin Label LblInfo 
  89.       Alignment       =   1  'Right Justify
  90.       BackColor       =   &H00C0C0C0&
  91.       Caption         =   "00:00:00"
  92.       ForeColor       =   &H00800000&
  93.       Height          =   255
  94.       Index           =   3
  95.       Left            =   4440
  96.       TabIndex        =   10
  97.       Top             =   1560
  98.       Width           =   1155
  99.    End
  100.    Begin Label LblInfo 
  101.       Alignment       =   1  'Right Justify
  102.       BackColor       =   &H00C0C0C0&
  103.       Caption         =   "00:00:00"
  104.       ForeColor       =   &H00000080&
  105.       Height          =   255
  106.       Index           =   2
  107.       Left            =   4440
  108.       TabIndex        =   15
  109.       Top             =   1320
  110.       Width           =   1155
  111.    End
  112.    Begin Label LblInfo 
  113.       Alignment       =   1  'Right Justify
  114.       BackColor       =   &H00C0C0C0&
  115.       Caption         =   "0"
  116.       ForeColor       =   &H00800000&
  117.       Height          =   255
  118.       Index           =   1
  119.       Left            =   4440
  120.       TabIndex        =   14
  121.       Top             =   1080
  122.       Width           =   1155
  123.    End
  124.    Begin Label LblTopic 
  125.       BackStyle       =   0  'Transparent
  126.       Caption         =   "Length:"
  127.       ForeColor       =   &H00800000&
  128.       Height          =   255
  129.       Index           =   3
  130.       Left            =   3000
  131.       TabIndex        =   13
  132.       Top             =   1560
  133.       Width           =   1155
  134.    End
  135.    Begin Label LblTopic 
  136.       BackStyle       =   0  'Transparent
  137.       Caption         =   "Time:"
  138.       ForeColor       =   &H00000080&
  139.       Height          =   255
  140.       Index           =   2
  141.       Left            =   3000
  142.       TabIndex        =   12
  143.       Top             =   1320
  144.       Width           =   1155
  145.    End
  146.    Begin Label LblTopic 
  147.       BackStyle       =   0  'Transparent
  148.       Caption         =   "Track:"
  149.       ForeColor       =   &H00800000&
  150.       Height          =   255
  151.       Index           =   1
  152.       Left            =   3000
  153.       TabIndex        =   11
  154.       Top             =   1080
  155.       Width           =   1155
  156.    End
  157.    Begin Label LblTopic 
  158.       BackStyle       =   0  'Transparent
  159.       Caption         =   "Status:"
  160.       ForeColor       =   &H00000080&
  161.       Height          =   255
  162.       Index           =   0
  163.       Left            =   3000
  164.       TabIndex        =   9
  165.       Top             =   840
  166.       Width           =   1155
  167.    End
  168.    Begin Label LblInfo 
  169.       Alignment       =   1  'Right Justify
  170.       BackColor       =   &H00C0C0C0&
  171.       Caption         =   "not ready"
  172.       ForeColor       =   &H00000080&
  173.       Height          =   255
  174.       Index           =   0
  175.       Left            =   4440
  176.       TabIndex        =   8
  177.       Top             =   840
  178.       Width           =   1155
  179.    End
  180.    Begin Label Label1 
  181.       Alignment       =   2  'Center
  182.       BackStyle       =   0  'Transparent
  183.       Caption         =   "Click once on each selection that you want to play."
  184.       ForeColor       =   &H00800000&
  185.       Height          =   435
  186.       Left            =   240
  187.       TabIndex        =   7
  188.       Top             =   180
  189.       Width           =   2595
  190.    End
  191. End
  192. Dim NewDisk%
  193.     
  194. Dim PlayItNow%
  195.  
  196. Dim PlayList$()
  197.  
  198. Dim UserStop%
  199.  
  200. Sub CmdAll_Click ()
  201.     If List1.ListCount = 0 Then
  202.         MsgBox "There are no audio tracks available."
  203.         Exit Sub
  204.         End If
  205.  
  206.     For x = 0 To List1.ListCount - 1
  207.         List1.Selected(x) = True
  208.         Next x
  209.  
  210.     List1.Refresh
  211.     CmdPlay_Click
  212. End Sub
  213.  
  214. Sub CmdNew_Click ()
  215.     Screen.MousePointer = 11
  216.     List1.Clear : List1.Refresh
  217.     NewDisk% = True
  218.     ReturnString$ = Space$(255)
  219.     CDstop ReturnString$
  220.     
  221.     ReturnString$ = Space$(255)
  222.     CDstatusInserted ReturnString$
  223.     status$ = Trim$(TrimAtNull(ReturnString$))
  224.     If status$ = "false" Then
  225.         Screen.MousePointer = 0
  226.         MsgBox "The CD drive is empty!"
  227.         Exit Sub
  228.         End If
  229.  
  230.     ReturnString$ = Space$(255)
  231.     CDstatusMode ReturnString$
  232.     status$ = Trim$(TrimAtNull(ReturnString$))
  233.     If status$ = "not ready" Then
  234.         Screen.MousePointer = 0
  235.         MsgBox "Can not read CD drive!"
  236.         Exit Sub
  237.         End If
  238.  
  239.     ReturnString$ = Space$(255)
  240.     CDstatusTracks ReturnString$
  241.     status$ = Trim$(TrimAtNull(ReturnString$))
  242.     If status$ = "1" Then
  243.         Screen.MousePointer = 0
  244.         MsgBox "Can not play a data CD!"
  245.         Exit Sub
  246.         End If
  247.     
  248.     TrackCount% = Val(status$)
  249.     ReDim PlayList(TrackCount%)
  250.     For x = 1 To TrackCount%
  251.         List1.AddItem "Track " + Format$(x)
  252.         PlayList(x) = "0,0" 'track,played
  253.         Next x
  254.     
  255.     
  256.     LblInfo(0).Caption = "stopped"
  257.     LblInfo(1).Caption = "0"
  258.     LblInfo(2).Caption = "00:00:00"
  259.     LblInfo(3).Caption = "00:00:00"
  260.     List1.Enabled = True
  261.     CmdAll.Enabled = True
  262.     UserStop% = False
  263.  
  264.     Screen.MousePointer = 0
  265. End Sub
  266.  
  267. Sub CmdOkay_Click ()
  268.     CmdStop_Click
  269.     Timer1.Enabled = False
  270.     Unload Me
  271. End Sub
  272.  
  273. Sub CmdPlay_Click ()
  274.     If List1.ListCount = 0 Then
  275.         MsgBox "There are no audio tracks available."
  276.         Exit Sub
  277.         End If
  278.     
  279.     If UserStop% = True Then
  280.         UserStop% = False
  281.         PlayItNow% = True
  282.         Exit Sub
  283.         End If
  284.     
  285.     counter% = 1
  286.     For x = 1 To List1.ListCount
  287.         If List1.Selected(x - 1) = True Then
  288.             PlayList(counter%) = Format$(x) + ",0"
  289.             counter% = counter% + 1
  290.             End If
  291.         Next x
  292.     
  293.     If counter% = 1 Then
  294.         MsgBox "No tracks are selected!"
  295.         Exit Sub
  296.         End If
  297.  
  298.     List1.Enabled = False
  299.     CmdAll.Enabled = False
  300.     PlayItNow = True
  301. End Sub
  302.  
  303. Sub CmdStop_Click ()
  304.     PlayItNow = False
  305.     UserStop% = True
  306.     ReturnString$ = Space$(255)
  307.     CDstop ReturnString$
  308.     LblInfo(2).Caption = "00:00:00"
  309.     
  310.     'reset played flag for current track (now play will start here)
  311.     For x = List1.ListCount To 1 Step -1
  312.         pos% = InStr(PlayList(x), ",")
  313.         track% = Val(Left$(PlayList(x), pos% - 1))
  314.         Played% = Val(Right$(PlayList(x), Len(PlayList(x)) - pos%))
  315.         If track% = 0 GoTo CheckNext
  316.         If Played% = -1 Then
  317.             PlayList(x) = Format$(track%) + ",0"
  318.             Exit For
  319.             End If
  320. CheckNext:
  321.         Next x
  322.  
  323. End Sub
  324.  
  325. Sub Form_Load ()
  326.     FormCenterScreen Me
  327.     DisplayedCDplayer = True
  328.     CmdNew_Click
  329.  
  330.     Screen.MousePointer = 0
  331. End Sub
  332.  
  333. Sub Form_Paint ()
  334.     DoForm3D Me, "raised", 2, 0
  335.     DoForm3D Me, "sunken", 2, 2
  336.  
  337.     DoControl3D List1, "sunken", 1
  338. End Sub
  339.  
  340. Sub Form_Unload (Cancel As Integer)
  341.     DisplayedCDplayer = False
  342. End Sub
  343.  
  344. Sub Timer1_Timer ()
  345.     ReturnString$ = Space$(255)
  346.     CDstatusMode ReturnString$
  347.     PlayStatus$ = Trim$(TrimAtNull(ReturnString$))
  348.     here% = DoEvents()
  349.     If LblInfo(0).Caption <> PlayStatus$ Then LblInfo(0).Caption = PlayStatus$
  350.     
  351.     ReturnString$ = Space$(255)
  352.     CDstatusPosition ReturnString$
  353.     status$ = Trim$(TrimAtNull(ReturnString$))
  354.     pos% = InStr(status$, ":")
  355.     status$ = Right$(status$, Len(status$) - pos%)
  356.     If PlayStatus$ <> "stopped" Then LblInfo(2).Caption = status$
  357.     
  358.     If PlayStatus$ = "playing" Then Exit Sub
  359.     If PlayItNow% = True Then
  360.         If PlayStatus$ = "stopped" Then
  361.             For x = 1 To List1.ListCount
  362.                 pos% = InStr(PlayList(x), ",")
  363.                 track% = Val(Left$(PlayList(x), pos% - 1))
  364.                 Played% = Val(Right$(PlayList(x), Len(PlayList(x)) - pos%))
  365.                 If track% <> 0 And Played% = 0 Then
  366.                     PlayList(x) = Format$(track%) + ",-1"
  367.                     ReturnString$ = Space$(255)
  368.                     CDstatusTrackLength ReturnString$, track%
  369.                     ThisLen$ = Trim$(TrimAtNull(ReturnString$))
  370.                     LblInfo(3).Caption = ThisLen$
  371.                     LblInfo(1).Caption = Format$(track%)
  372.                     ReturnString$ = Space$(255)
  373.                     CDplay ReturnString$, track%
  374.                     Exit Sub
  375.                     End If
  376.                 Next x
  377.             If CheckLoop.Value = 1 Then
  378.                 UserStop = False
  379.                 PlayItNow% = False
  380.                 CmdPlay_Click
  381.                 End If
  382.             End If
  383.         End If
  384. End Sub
  385.  
  386.